﻿<phone:PhoneApplicationPage xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"  
    x:Class="QWeiBoN.UserControler.UserDetailView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:controls="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
    xmlns:converter="clr-namespace:QWeiBoN.Converter"
    xmlns:es="clr-namespace:Microsoft.Expression.Shapes;assembly=Microsoft.Expression.Drawing"
    mc:Ignorable="d" d:DesignWidth="480" d:DesignHeight="800"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    SupportedOrientations="Portrait"  Orientation="Portrait"
    shell:SystemTray.IsVisible="False">
    
    <phone:PhoneApplicationPage.Resources>
        <converter:ConvertWeiboContentBehavior x:Key="ConvertWeiboContentBehavior" />
        <converter:TextImageSourceConverter x:Key="TextImageSourceConverter"/>
        <converter:StatusNameAndTextIsShow x:Key="StatusNameAndTextIsShow"/>
        <converter:VipImageShow x:Key="VipImageShow" />
    </phone:PhoneApplicationPage.Resources>

    <!--LayoutRoot 包含根网格，其他所有页面内容都位于根网格中-->
    <Grid x:Name="LayoutRoot">
        <controls:Panorama x:Name="UserInfoPanorama" SelectionChanged="Panorama_SelectionChanged">
            <controls:Panorama.Title>
                <StackPanel Orientation="Vertical" x:Name="UserDetailHeadPanel" Margin="10,90,0,0">
                    <StackPanel Orientation="Horizontal">
                        <Image x:Name="DetailUserHeadImg" Stretch="Fill" Width="100" Height="100" Source="/Resources/noHead.png" />
                        <StackPanel HorizontalAlignment="Left" VerticalAlignment="Center" Margin="10,0,0,0">
                            <StackPanel Orientation="Horizontal" HorizontalAlignment="Left" VerticalAlignment="Center">
                                <TextBlock x:Name="DetailUserNickText" Style="{Binding DetailUserNickStyle}" Text="张磊" FontSize="30" />
                                <Image x:Name="DetailUserVipImg" Source="/Resources/v.png" Stretch="Fill" Width="24" Height="24" Visibility="Collapsed" />
                            </StackPanel>
                            <TextBlock x:Name="DetailUserNameText" Text="张张" FontSize="20" Style="{StaticResource DetailUserName}"/>
                        </StackPanel>
                    </StackPanel>
                    <!-- 进度条 -->
                    <toolkit:PerformanceProgressBar x:Name="HeadPanelProgressBar" Margin="0,10,0,0" Width="400" HorizontalAlignment="Center" Style="{Binding PerformanceProgressBarStyle}" />
                </StackPanel>
            </controls:Panorama.Title>

            <!--Panorama 项目一-->
            <controls:PanoramaItem>
                <controls:PanoramaItem.HeaderTemplate>
                    <DataTemplate>
                        <StackPanel Orientation="Horizontal" HorizontalAlignment="Left" VerticalAlignment="Bottom">
                            <TextBlock Text="用户资料" FontSize="50" />
                        </StackPanel>
                    </DataTemplate>
                </controls:PanoramaItem.HeaderTemplate>
                <Grid x:Name="UserDetailItemGrid">
                    <StackPanel>
                        <TextBlock Text="个人资料" Style="{Binding UserInfoTitleStyle}" />
                        <StackPanel Orientation="Horizontal">
                            <TextBlock Text="{Binding Sex}" Style="{Binding UserInfoContentStyle}" />
                            <TextBlock Text="{Binding Location}" Margin="12,0,0,0" Style="{Binding UserInfoContentStyle}" />
                        </StackPanel>
                        <TextBlock x:Name="UserIntroduction" Text="{Binding Introduction}" Style="{Binding UserInfoContentStyle}" />
                        <TextBlock Text="认证信息" Style="{Binding UserInfoTitleStyle}" Visibility="Collapsed" />
                        <TextBlock x:Name="UserVerifyInfo" Text="{Binding VerifyInfo }" Style="{Binding UserInfoContentStyle}" Visibility="Collapsed" />
                        <Grid Height="120">
                            <Grid.RowDefinitions>
                                <RowDefinition Height="120" />
                                <RowDefinition Height="*" />
                            </Grid.RowDefinitions>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="120" />
                                <ColumnDefinition Width="15" />
                                <ColumnDefinition Width="120" />
                                <ColumnDefinition Width="15" />
                                <ColumnDefinition Width="*" />
                            </Grid.ColumnDefinitions>
                            <Grid Grid.Row="0" Grid.Column="0" Style="{Binding UserInfoCountBlock}">
                                <TextBlock Text="微博" Style="{Binding UserInfoCountTitleStyle}" />
                                <TextBlock x:Name="UserInfoStatusCount" Text="{Binding Tweetnum}" Style="{Binding UserInfoCountNumStyle}" />
                            </Grid>
                            <Grid Grid.Row="0" Grid.Column="2" HorizontalAlignment="Left" Style="{Binding UserInfoCountBlock}">
                                <TextBlock Text="收听" Style="{Binding UserInfoCountTitleStyle}" />
                                <TextBlock x:Name="UserInfoListenerCount" Text="{Binding IdolNum}" Style="{Binding UserInfoCountNumStyle}" />
                            </Grid>
                            <Grid Grid.Row="0" Grid.Column="4" HorizontalAlignment="Left" Style="{Binding UserInfoCountBlock}">
                                <TextBlock Text="听众" Style="{Binding UserInfoCountTitleStyle}" />
                                <TextBlock x:Name="UserInfoFansCount" Text="{Binding Fansnum}" Style="{Binding UserInfoCountNumStyle}" />
                            </Grid>
                        </Grid>
                    </StackPanel>
                </Grid>
            </controls:PanoramaItem>

            <!--Panorama 项目二-->
            <controls:PanoramaItem>
                <controls:PanoramaItem.Header>
                    <StackPanel Orientation="Horizontal">
                        <TextBlock Text="用户广播" FontSize="50" />
                        <TextBlock x:Name="UserStatusCount" Text="100" Style="{Binding HeaderSubTextStyle}" />
                    </StackPanel>
                </controls:PanoramaItem.Header>
                <Grid>
                    <ListBox x:Name="UserDetailStatusList" Tap="UserDetailStatusList_Tap">
                        <ListBox.ItemTemplate>
                            <DataTemplate>
                                <StackPanel HorizontalAlignment="Left" Orientation="Vertical">
                                    <!-- 行弹出菜单 -->
                                    <toolkit:ContextMenuService.ContextMenu>
                                        <toolkit:ContextMenu Style="{StaticResource ContextMenuStyle}">
                                            <toolkit:MenuItem Header="转播" Tap="MenuItem_Tap" Tag="{Binding Id}" Style="{StaticResource MenuItemStyle}" />
                                            <toolkit:MenuItem Header="回复" Tap="MenuItem_Tap_1" Tag="{Binding Id}" Style="{StaticResource MenuItemStyle}" />
                                            <toolkit:MenuItem Header="收藏" Tap="MenuItem_Tap_2" Tag="{Binding Id}" Style="{StaticResource MenuItemStyle}" />
                                        </toolkit:ContextMenu>
                                    </toolkit:ContextMenuService.ContextMenu>
                                    <StackPanel Orientation="Horizontal" HorizontalAlignment="Left">
                                        <HyperlinkButton x:Name="NickLinkBtn" Content="{Binding Nick}" FontSize="21" Tag="{Binding Name}" HorizontalAlignment="Left" VerticalAlignment="Top" Padding="0" />
                                        <Image Source="/Resources/v.png" Stretch="Fill" Width="24" Height="24" Visibility="{Binding Isvip, Converter={StaticResource VipImageShow}}" />
                                    </StackPanel>
                                    <RichTextBox Padding="0" FontSize="21" Margin="-10,5,0,0" TextWrapping="Wrap" HorizontalAlignment="Left" VerticalAlignment="Top" Tag="{Binding Id}" CacheMode="BitmapCache">
                                        <i:Interaction.Behaviors>
                                            <converter:ConvertWeiboContentBehavior Content="{Binding Origtext}"></converter:ConvertWeiboContentBehavior>
                                        </i:Interaction.Behaviors>
                                    </RichTextBox>
                                    <Image x:Name="StatusImage" Margin="0,5,0,0" Source="{Binding Image, Converter={StaticResource TextImageSourceConverter}}" Stretch="None" HorizontalAlignment="Left" VerticalAlignment="Top" Tag="{Binding Image, Converter={StaticResource TextImageSourceConverter}}" />
                                    <Grid Visibility="{Binding Source, Converter={StaticResource StatusNameAndTextIsShow}}" Margin="0,5,0,0">
                                        <Grid.RowDefinitions>
                                            <RowDefinition Height="8" />
                                            <RowDefinition Height="*" />
                                        </Grid.RowDefinitions>
                                        <es:RegularPolygon Style="{StaticResource ParentTextBackgroundArrow}">
                                            <es:RegularPolygon.RenderTransform>
                                                <CompositeTransform SkewX="37"/>
                                            </es:RegularPolygon.RenderTransform>
                                        </es:RegularPolygon>
                                        <Grid Grid.Row="1" Style="{StaticResource TweetListParentTextBg}">
                                            <StackPanel Margin="5,5,0,10" HorizontalAlignment="Left" Orientation="Vertical">
                                                <StackPanel HorizontalAlignment="Left" Orientation="Horizontal">
                                                    <HyperlinkButton x:Name="fNickLinkBtn" Content="{Binding Source, Converter={StaticResource StatusNameAndTextConverter}}" FontSize="21" Tag="{Binding Source.OpenId}" HorizontalAlignment="Left" VerticalAlignment="Top" Padding="0" Margin="-10,0,-10,0" />
                                                    <Image Source="/Resources/v.png" Stretch="Fill" Width="24" Height="24" Visibility="{Binding Isvip, Converter={StaticResource VipImageShow}}" />
                                                </StackPanel>
                                                <RichTextBox Padding="0" FontSize="21" Margin="-10,5,0,0" TextWrapping="Wrap" HorizontalAlignment="Left" VerticalAlignment="Top" CacheMode="BitmapCache">
                                                    <i:Interaction.Behaviors>
                                                        <converter:ConvertWeiboContentBehavior Content="{Binding Source.Origtext}"></converter:ConvertWeiboContentBehavior>
                                                    </i:Interaction.Behaviors>
                                                </RichTextBox>
                                                <Image Name="SourceImg" Margin="0,5,0,0" Source="{Binding Source, Converter={StaticResource StatusNameAndImageConverter}}" Tag="{Binding Source, Converter={StaticResource StatusNameAndImageConverter}}" Stretch="None" HorizontalAlignment="Left" VerticalAlignment="Top" />
                                            </StackPanel>
                                        </Grid>
                                    </Grid>
                                </StackPanel>
                            </DataTemplate>
                        </ListBox.ItemTemplate>
                        <!-- 手势监听 -->
                        <toolkit:GestureService.GestureListener>
                            <toolkit:GestureListener DragStarted="GestureListener_DragStarted" GestureCompleted="GestureListener_GestureCompleted" />
                        </toolkit:GestureService.GestureListener>
                    </ListBox>
                </Grid>
            </controls:PanoramaItem>
        </controls:Panorama>
    </Grid>

    <!--基于 Panorama 的应用程序不应显示 ApplicationBar-->
    <phone:PhoneApplicationPage.ApplicationBar>
        <shell:ApplicationBar IsVisible="True" IsMenuEnabled="True" Opacity="0.9">
            <shell:ApplicationBarIconButton x:Name="UserListenBarBtn" Click="UserListenBarBtn_Click" IconUri="/Images/appbar_button1.png" Text="收听"/>
            <shell:ApplicationBarIconButton x:Name="UserSelfishBarBtn" IconUri="/Images/appbar_button2.png" Text="私信"/>
            <shell:ApplicationBarIconButton x:Name="UserTaBarBtn" IconUri="/Images/appbar_button2.png" Text="@ta" />
            <shell:ApplicationBarIconButton x:Name="UserDetailBackBarBtn" Click="UserDetailBackBarBtn_Click" IconUri="/Images/appbar_button2.png" Text="返回" />
            <shell:ApplicationBar.MenuItems>
                <shell:ApplicationBarMenuItem x:Name="HomeBackBarBtn" Click="HomeBackBarBtn_Click" Text="主页" />
            </shell:ApplicationBar.MenuItems>
        </shell:ApplicationBar>
    </phone:PhoneApplicationPage.ApplicationBar>

</phone:PhoneApplicationPage>